package com.xzx.masterslave.masterslave.utils;

/**
 * 日期加4位顺序数
 * @author admin
 */
public class RandomNumberUtil {
    private static final String BATCH_ID_KEY = ".random.number.id";
    public static String getBatchId() {
        String today = DateUtils.getCurrentDate(DateUtils.format8);
        String key = today + BATCH_ID_KEY;
        Long batchId = CacheUtils.incr(key);
        CacheUtils.expire(key, 86400);
        return today +  String.format("%0" +4+ "d", batchId.intValue());
    }
}
